home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
grep
/
grep
< prev
next >
Wrap
Text File
|
1994-08-27
|
3KB
|
64 lines
e?grep version 1.3
-rw-rw-r-- 1 gray 79925 Sep 25 15:17 grep.lzh
GNU e?grep is based on a fast lazy-state deterministic matcher (about
twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper
search for a fixed string that eliminates impossible text from being
considered by the full regexp matcher without necessarily having to
look at every character. The result is typically many times faster
than Unix grep or egrep. (Regular expressions containing backreferencing
may run more slowly, however.)
GNU e?grep attempts, as closely as possible, to understand compatibly
the regexp syntaxes of the Unix programs it replaces. The following table
details the various special characters understood in both the grep and
egrep incarnations:
(grep) (egrep) (explanation)
. . matches any single character except newline
\? ? postfix operator; preceeding item is optional
* * postfix operator; preceeding item 0 or more times
\+ + postfix operator; preceeding item 1 or more times
\| | infix operator; matches either argument
^ ^ matches the empty string at the beginning of a line
$ $ matches the empty string at the end of a line
\< \< matches the empty string at the beginning of a word
\> \> matches the empty string at the end of a word
[chars] [chars] match any character in the given class; if the
first character after [ is ^, match any character
not in the given class; a range of characters may
be specified by <first>-<last>; for example, \W
(below) is equivalent to the class [^A-Za-z0-9]
\( \) ( ) parentheses are used to override operator precedence
\<1-9> \<1-9> \<n> matches a repeat of the text matched earlier
in the regexp by the subexpression inside the
nth opening parenthesis
\ \ any special character may be preceded by a backslash
to match it literally
(the following are for compatibility with GNU Emacs)
\b \b matches the empty string at the edge of a word
\B \B matches the empty string if not at the edge of a word
\w \w matches word-constituent characters (letters & digits)
\W \W matches characters that are not word-constituent
Operator precedence is (highest to lowest) ?, *, and +, concatenation,
and finally |. All other constructs are syntactically identical to
normal characters. For the truly interested, a comment in dfa.c describes
the exact grammar understood by the parser.
GNU e?grep understands the following command line options:
-A <num> print <num> lines of context after every matching line
-B <num> print <num> lines of context before every matching line
-C print 2 lines of context on each side of every match
-<num> print <num> lines of context on each side
-V print the version number on stderr
-b print every match preceded by its byte offset
-c print a total count of matching lines only
-e <expr> search for <expr>; useful if <expr> begins with -
-f <file> take <expr> from the given <file>
-h don't display filenames on matches
-i ignore case difference when comparing strings
-l list files containing matches only
-n print each match preceded by its line number